﻿using System;
using System.Xml;
using System.Drawing;
using System.Xml.Serialization;
using rlTodayMakeSkin.Project;
using rlTodayMakeSkin.Project.Attributes;
using rlTodayMakeSkin.Project.XmlElement.XmlSubElements;


namespace rlTodayMakeSkin.Project.XmlElement
{
    /// <summary>
    /// represents an xml Application element in skin.xml file
    /// </summary>
    public class rlApplication : rlTodayXmlElement
    {

        private int appnumber = 0;
        private int intSize = 64;

        public rlApplication(XmlAttributeCollection attributi, rlTodayProject prj)
            : base(attributi, prj)
        {
            if (attributi["appnumber"] != null) appnumber = int.Parse(attributi["appnumber"].Value);
            strNome = "Application";

        }

        public rlApplication(rlTodayProject prj)
            : base(prj)
        {
            strNome = "Application";
        }

        public rlApplication() { }


        /// <summary>
        /// Gets, sets application index in the list of application 
        /// specificated in the rlToday settings
        /// </summary>
        [PropertyDescription("Gets, sets application index in the list of application specificated in the rlToday settings", PropertyTypes.INTEGER)]
        [XmlAttribute("appnumber")]
        public int AppNumber
        {
            get { return appnumber; }
            set { appnumber = value;}
        }

        /// <summary>
        /// Sets, gets the size of this element
        /// </summary>
        [PropertyDescription("Gets, sets the size of this element")]
        [XmlAttribute("size")]
        public int size
        {
            get { return intSize; }
            set { intSize = value;}
        }

        public override void DrawElement(Graphics g)
        {
            DrawImage(g,"ApplicationBig.png");
            Font f = new Font("Times new Roman", 11, FontStyle.Bold);
            g.DrawString(appnumber.ToString(),f, Brushes.Red, new Point(10, 0));
        }

        /******************
         PRIVATE MEMBERS
         *****************/
    }
}
